import java.util.ArrayList;

public class Trainer {
	String name;
	private ArrayList<pokemon> pokemons;
	
	public Trainer(String name){
		this.name = name;
		pokemons = new ArrayList<Pokemon>();
	}
	
	public void addPokemon(Pokemon pokemon){
		pokemons.add(pokemon);
	}
	
	public Pokemon throwPokeball(){
		for(int i = 0; i < pokemons.size(); i++){
			Pokemon pokemon = pokemons.get(i);
			if(pokemon.isAlive()){
				return pokemon;
			}			
		}	
		return null;
	}
	
	public String toString(){
		String str = "name: " + name + "\n"
				+ "pokemons:\n";
		for(int i = 0; i < this.pokemons.size(); i++){
			str = str + this.pokemons.get(i) + "\n";
		}		
		return str;
	}
}
